// 导入二次封装axios
import koi from "@/utils/axios.ts";

// 统一管理接口
enum API {
  gl_public = '/public',
  gl_user = '/user'
}

// 获取token
export const getToken = () => {
  return koi.get(API.gl_public + '/token');
};

// 获取图形验证码
export const getCode = () => {
  return koi.get(API.gl_public + '/captch', { easy: true });
};

// 密码登录
export const login = (data: { account: string, password: string, captcha: string }) => {
  console.log('密码登录', data);
  return koi.post(API.gl_public + '/login', data);
};

// 获取用户登录状态
export const getUserInfo = () => {
  return koi.get(API.gl_public + '/onlineState');
};

// 获取自己用户身份信息
export const getSelfInfo = () => {
  return koi.get(API.gl_user);
};